/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package tableCellRender;

import java.awt.Component;
import javax.swing.JTable;
import javax.swing.JTextField;
import static javax.swing.SwingConstants.CENTER;
import javax.swing.table.TableCellRenderer;
import otros.Util;

/**
 *
 * @author FERRETERIA
 */
public class TipoPago implements TableCellRenderer  {
    private int filaSel;
    private boolean fuera;

    public TipoPago (int fila, boolean fuera) {
        super();
        filaSel = fila;
        this.fuera = fuera;
    }
    
    @Override
    public Component getTableCellRendererComponent(final JTable jtable, Object value, boolean selected, boolean focused, int row, int column) {
        JTextField t = new JTextField();
        t.setBorder(null);
        t.setOpaque(true);
        t.setHorizontalAlignment(CENTER);
        if ( value != null) {
            String valor = "";
            switch ((String)value) {
                case "0":
                    valor = "Efectivo";
                    break;
                case "1":
                    valor = "Tarjeta";
                    break;
                case "2":
                    valor = "Cheque";
                    break;
                case "3":
                    valor = "Tranferencia";
                    break;
                case "4":
                    valor = "Vale";
                    break;    
                case "10": 
                    valor = "Alb Efectivo";
                    break;
                case "11": 
                    valor = "Alb Tarjeta";
                    break;
                case "12": 
                    valor = "Alb Cheque";
                    break;
                case "13": 
                    valor = "Alb Transfe";
                    break;
                case "14":
                    valor = "Alb Vale";
                    break;
            }
            t.setText(valor);
        } else
            t.setText("");
        t.setBackground(Util.getBackground(row,filaSel,jtable, selected, fuera));
        t.setForeground(Util.getForeground(row,filaSel,jtable,selected, fuera));          
        return t;
    }
}
